package com.gqzmy.springboot3.filters;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 周小哥  gqzmy@163.com 2022/12/1 21:17
 */

@Configuration
public class FilterConfig {

    @Bean("traceIdFilter")
    public FilterRegistrationBean<TraceIdFilter> registrationFilter() {
        FilterRegistrationBean<TraceIdFilter> registrationBean = new FilterRegistrationBean<>();
        registrationBean.setFilter(new TraceIdFilter());
        registrationBean.addUrlPatterns("/division/*");
        registrationBean.setOrder(2);
        registrationBean.setAsyncSupported(true);
        return registrationBean;
    }

}
